﻿using System.Linq;
using UpdateControls.Correspondence;

namespace SurveySez.Model
{
	public partial class Response
	{
		public void Delete()
		{
			Community.AddFact(new ResponseDelete(this));
		}

		public string Answer
		{
			get { return CurrentAnswers.Select(ra => ra.Answer).FirstOrDefault(); }
			set { Community.AddFact(new ResponseAnswer(this, CurrentAnswers, value)); }
		}

		public float Order
		{
			get { return CurrentOrders.Select(ro => ro.Order).FirstOrDefault(); }
			set { Community.AddFact(new ResponseOrder(this, CurrentOrders, value)); }
		}
	}
}
